package com.github.butid.data.netty.handler;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.ReferenceCountUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 报文解密
 * @author wangjing.dc@qq.com
 * @since 2020/8/4
 */
@Component
@Slf4j
@ChannelHandler.Sharable
public class DesEncrypter extends SimpleChannelInboundHandler {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
//        log.debug("收到待解密消息:{}", msg);

        ctx.fireChannelRead(msg);

        ReferenceCountUtil.release(msg);
    }
}
